Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
Mac and OpenDoc are trademarks of Apple Computer, Inc.
Introduction
A well behaved part editor needs keep track of it's display frames, and store & retrieve them from an annotation property on its storageunit. This document contains the list of methods affected, and a brief description of their responsibilities. The sample code documents step by step how to implement this functionality in those methods.
Caveats
• This code contains minimal proper error checking
• It does not account for the case where a part may want to do AbstractTertiaryCase.
• It uses the CLink and CLinkedList classes which are an unsupported utility of OpenDoc.
• It uses StorUtil.h and StdTypIO.h which are two more unsupported utilities of OpenDoc. It is recommended that you copy the sample code from these unsupported utilities into your project.
• It does not contain any optimizations such as lazily internalizing your display frames, or only rewriting your list of display frames when it changes.
• Sample Code taken from "SamplePart".
• Sample Code may not contain all the necessary #includes.
• Sample Code is written with the assumption that the rest of the implementation follows the SOM Wrapper/C++ Implementation strategy.
• Sample Code does not contain full implementation for the methods listed. Sample Code is intended to be added to the implementation of the methods listed.
Methods Affected
• Constructor
Clear fDisplayFrames.
• Destructor
Delete fDisplayFrames if it is not null, and set it to null.
• InitPart
Create a new, empty collection (fDisplayFrames) in which to store a list of your display frames.
• DisplayFrameAdded
Add the frame passed in to fDisplayFrames.
• DisplayFrameConnected
Add the frame passed in to fDisplayFrames if it is not already in the list.
• DisplayFrameRemoved
Remove the frame passed in from fDisplayFrames.
• DisplayFrameClosed
Remove the frame passed in from fDisplayFrames.
• Externalize
If necessary create a DisplayFrames annotation property and StorageUnitRefs value on your storageunit.
Otherwise just focus to your DisplayFrames annotation property and its StorageUnitRefs value.
Write out a list of references to your display frames from fDisplayFrames.
• InitPartFromStorage
Focus to your DisplayFrames annotation property and its StorageUnitRefs value.
Read in the list of your display frames into fDisplayFrames. See the Lazy Frame Internalization recipe for more info.
• ReleaseAll
Assert that you fDisplayFrames collection is empty.
Sample Code
void CMyPart::CMyPart()
{
…
fDisplayFrames = kODNULL;
…
}
void CMyPart::~CMyPart()
{
…
if (fDisplayFrames != kODNULL)
{
delete fDisplayFrames;
fDisplayFrames = kODNULL;
}
…
}
void CMyPart::InitPart(
Environment* ev,
ODStorageUnit* storageUnit,
ODPart* partWrapper
)
{
…
// Create a list to keep track of the frames we are being
// displayed in.
fDisplayFrames = new CLinkedList;
…
}
void CMyPart::InitPartFromStorage(
Environment* ev,
ODStorageUnit* storageUnit,
ODPart* partWrapper
)
{
…
// Create a list to keep track of the frames we are being